package com.dkd.day20250702;
import java.util.*;

public class Main1 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        String s = sc.nextLine();
        //数据处理
        String[] split = s.split(";");

        String[] s0 = split[0].split(",");
        String[] s1 = split[1].split(",");
        String[] s2 = split[2].split(",");
        String[] sx = split[3].split(",");
        String[] sy = split[4].split(",");
        String[] sb = split[5].split(",");

        double[] a0 = new double[s0.length];
        for (int i = 0; i < s0.length; i++) {
            a0[i] = Double.parseDouble(s0[i]);
        }


        double[] a1 = new double[s1.length];
        for (int i = 0; i < s1.length; i++) {
            a1[i] = Double.parseDouble(s1[i]);

        }
        double[] a2 = new double[s2.length];
        for (int i = 0; i < s2.length; i++) {
            a2[i] = Double.parseDouble(s2[i]);
        }
        int[] x = new int[sx.length];
        for (int i = 0; i < sx.length; i++) {
            x[i] = Integer.parseInt(sx[i]);
        }
        String[] a4 = new String[sb.length];
        for (int i = 0; i < sb.length; i++) {
            a4[i] = sb[i];
        }
        double[] ay = new double[sy.length];
        for (int i = 0; i < sy.length; i++) {
            ay[i] = Double.parseDouble(sy[i]);
        }


        //计算
        double re1 = a0[0]*x[0]+a0[1]*x[1]+a0[2]*x[2]+a0[3]*x[3]+a0[4]*x[4];
        double re2 = a1[0]*x[0]+a1[1]*x[1]+a1[2]*x[2]+a1[3]*x[3]+a1[4]*x[4];
        double re3 = a2[0]*x[0]+a2[1]*x[1]+a2[2]*x[2]+a2[3]*x[3]+a2[4]*x[4];


        boolean flag = bool(re1,ay[0],a4[0]) && bool(re2,ay[1],a4[1]) && bool(re3,ay[2],a4[2]);
        re1 = (int)(re1 - ay[0]);
        re2 = (int)(re2 - ay[1]);
        re3 = (int)(re3 - ay[2]);

        System.out.print(flag);
        System.out.print(" ");
        int maxResult = (int)(Math.max(Math.max(re1, re2), re3));
        System.out.println(maxResult);

    }

    static boolean  bool(double res,double x,String b) {
        boolean flag = true;
        if(b.equals("<")) {
            if(res<x){
                return true;
            }else{
                return false;
            }
        }else if(b.equals(">")) {
            if(res>x){
                return true;
            }else{
                return false;
            }
        }else if(b.equals(">=")) {
            if(res>=x){
                return true;
            }else{
                return false;
            }
        }else if(b.equals("<=")) {
            if(res<=x){
                return true;
            }else{
                return false;
            }
        }else{
            if(res==x){
                return true;
            }else{
                return false;
            }
        }

    }
}

